import {
  getToken
} from "../../../utils/getToken";

Page({
  data: {
    list: {}
  },
  onLoad() {
    this.getList()
  },
  getList() {
    wx.request({
      url: 'https://live-api.itheima.net/visitor',
      data: {
        current: 1,
        pageSize: 10
      },
      header: {
        Authorization: 'Bearer ' + getToken()
      },
      success: (res) => {
        console.log(res);
        if (res.data.code !== 10000) {
          wx.showToast({
            title: res.data.message,
            icon: 'none'
          })
        }
        this.setData({
          list: res.data.data.rows
        })
        console.log(this.data.list);
      }
    })
  },
  goPassport(e) {
    // console.log(e);
    wx.navigateTo({
      url: `/visitor_pkg/pages/passport/index?id=${e.mark.id}`,
    })
  },
})